<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>业务部门列表</title>
<%@include file="/WEB-INF/jsp/public/commons.jspf"%>
</head>
<body>
 <ol class="breadcrumb">
  <li><a href="home_innerCentre.action">首页</a></li>
  <li class="active">部门管理</li>
</ol>


	<form id="pageCondition" action="department_list.action" class="col-sm-10 bs-example bs-example-form" style="float:left;" role="form">
		<div class="input-group col-sm-4" style="float:left;"> 
         	<input type="text" name="name" value="${name }" class="form-control input-medium search-query" style="float:left;" placeholder="公司名查询">
        </div>
        <div class="input-group col-sm-4" style="float:left;"> 
         <input type="text" name="functionary" value="${functionary }" class="form-control input-medium search-query" placeholder="负责人查询">
	    </div>
	    <div class="input-group col-sm-2">
	      <input type="submit" class="btn btn-default" value="查询"/>
	    </div>
	</form>
	<s:if test="#session.user.hasPrivilegeByName('部门添加')">
	<div class="col-sm-2" style="float:right;margin-bottom: 10px;">
	  <!-- 按钮触发模态框 -->
	  <button class="btn btn-success glyphicon glyphicon-plus" data-toggle="modal" 
	   data-target="#myModal" >
	   	 添加
	  </button>
	</div>
	 </s:if>
  
  <!-- 模态框（Modal） -->
 <div class="modal fade in" id="myModal" tabindex="-1" role="dialog" style="display: none;" aria-labelledby="confirmModalLabel" aria-hidden="true">
		<div class="modal-dialog" >
			<div class="modal-content">
				<form  id="depatrmentForm"  action="${pageContext.request.contextPath }/department_add.action" method="post" enctype="multipart/form-data" role="form" style="width: 90%;margin: 0 0 0 20px">
			         <div class="modal-header">
			            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			            <h4 class="modal-title" id="confirmModalLabel">添加模块</h4>
			         </div>
		            <input type="hidden" id="departmentid" name="id"/>
		         	<div class="modal-body" id="modal_confirm">
	         			<div class="form-group">
		         	        <label for="name">物业公司名称</label>
						    <input type="text" name="name" class="form-control" placeholder="请输入公司名">
	         			</div>
	         			<div class="form-group">
		         	        <label for="name">地址</label>
						    <input type="text" name="address" class="form-control" placeholder="请输入公司地址">
	         			</div>
	         			<div class="form-group">
		         	        <label for="name">Email</label>
						    <input type="text" name="email" class="form-control" placeholder="请输入公司Email">
	         			</div>
	         			
	         			<div class="form-group">
		         	        <label for="name">电话</label>
						    <input type="text" name="phoneNumber" class="form-control" placeholder="请输入公司电话">
	         			</div>
	         			<div class="form-group">
		         	        <label for="name">负责人</label>
						    <input type="text" name="functionary" class="form-control" placeholder="请输入公司负责人">
	         			</div>
	         			<div class="form-group">
		         	        <label for="name">注册码</label>
						    <input type="text" name="regNumber" class="form-control" placeholder="请输入公司注册码">
	         			</div>
						
	
		         	 </div>
		         	
			         	<div class="modal-footer">
				            <input type="submit" id="departmentsubmit" class="btn btn-primary" value="确定"/>
				            <button type="button" class="btn btn-default"  data-dismiss="modal" id="cencle_button">关闭 </button>
				        </div>
	         	</form>
	         </div>
		
		</div>
	</div>
  
 <div class="container-fluid">
<table class="table table-striped table-bordered">
   <thead>
      <tr class="success">
       
		<td>公司名</td>
		<td>地址</td>
		<td>Email</td>
		<td>电话号码</td>
		<td>负责人</td>
		<td>注册码</td>
		<td>操作</td>
      </tr>
   </thead>
   <tbody>
    <s:iterator value="recordList">
		<tr>
			<td>${name}</td>
			<td>${address}</td>
			<td>${email}</td>
			<td>${phoneNumber}</td>
			<td>${functionary}</td>
			<td>${regNumber}</td>
			<td>
				<s:a action="department_delete?id=%{id}" onclick="return confirmAct();">删除</s:a>
				<s:a action="department_updUI?id=%{id}">修改</s:a>
				<s:a action="department_sendMailUI?id=%{id}">邮件发送</s:a>
			</td>
		</tr>
	</s:iterator>
   </tbody>
</table>
<%--分页信息 --%>

<%@include file="/WEB-INF/jsp/public/pageView.jspf"%>




</div>
</body>
<script type="text/javascript">
  		$(function(){
	$('#depatrmentForm').bootstrapValidator({
		message: 'This value is not valid',
		feedbackIcons: {
			valid: 'glyphicon glyphicon-ok',
			invalid: 'glyphicon glyphicon-remove',
			validating: 'glyphicon glyphicon-refresh'
			},
        fields: {
        	
            phoneNumber: {
                validators: {
                    notEmpty: {
                        message: '电话不能为空'
                    },
                    stringLength: {
                        min: 11,
                        max: 11,
                        message: '请输入11位手机号码'
                    },
                    regexp: {
                        regexp: /^1[3|5|8]{1}[0-9]{9}$/,
                        message: '请输入正确的手机号码'
                    }
                }
            },
            email: {
                validators: {
                    notEmpty: {
                        message: '邮箱不能为空'
                    },
                    emailAddress: {  
                        message: '邮箱地址格式有误'  
                    }
                }
            },
            regNumber: {
                validators: {
                    notEmpty: {
                        message: '注册码不能为空'
                    },
                    regexp: {
                        regexp: /^\d{13}$/,
                        message: '请输入13位数字'
                    }
                }
            },
           	name: {
                validators: {
                    notEmpty: {
                        message: '公司名不能为空'
                    }
                }
            },
           	address: {
                validators: {
                    notEmpty: {
                        message: '地址不能为空'
                    }
                }
            },
           	functionary: {
                validators: {
                    notEmpty: {
                        message: '负责人不能为空'
                    }
                }
            }            
        }
    }); 
});
  	function confirmAct(){  
         if(confirm('确定要删除此投诉消息吗?')){ 
        return true; 
    } 
    return false; 
} 	
  		
  </script>
</html>